package cn.com.bluemoon.daps.standard.controller.api;

import cn.com.bluemoon.daps.api.standard.RemoteStandardDimService;
import cn.com.bluemoon.daps.common.constant.ServiceNameConstants;
import cn.com.bluemoon.daps.common.datascope.IgnorePermission;
import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.standard.entity.DapStandardDim;
import cn.com.bluemoon.daps.standard.service.DapStandardDimService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * 服务接口生产类-内部调用
 *
 * @author Jarod.Kong
 */
@Api(tags = {"FeignClient服务-标准维度注入Api"})
@RestController
@RequestMapping(ServiceNameConstants.DapsApiStandard.API_DIM_STD)
@IgnorePermission(name = "服务注册-标准维度服务")
public class DapsStandardDimApi implements RemoteStandardDimService {
    @Resource
    private DapStandardDimService standardDimService;

    @Override
    public ResultBean<DapStandardDim> getById(String id) {
        return ResultBean.ok(standardDimService.getById(id));
    }

    @Override
    public ResultBean<Boolean> relatedBizLineId(Integer bizLineId) {
        return ResultBean.ok(standardDimService.count(standardDimService.bmLambdaQuery()
                .eq(DapStandardDim::getBizLineId, bizLineId)) > 0);
    }
}
